<template>
  <div class="dashboard-container">
    <div class="dashboard-text" style="margin-bottom: 15px;">
      <el-row>
        <el-col :span="10">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">审核状态：</span>
            <el-select v-model="value" placeholder="请选择" style="width: 50%;">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
        </el-col>
        <el-col :span="10">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">商户ID：</span>
            <el-input v-model="input" placeholder="请输入内容" style="width: 50%;" />
          </div>
        </el-col>
        <el-col :span="4" />
      </el-row>
      <el-row>
        <el-col :span="10">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">添加者：</span>
            <el-select v-model="value" placeholder="请选择" style="width: 50%;">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
        </el-col>
        <el-col :span="10">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">商户名称：</span>
            <el-input v-model="input" placeholder="请输入内容" style="width: 50%;" />
          </div>
        </el-col>
        <el-col :span="4" style="text-align: right;">
          <el-button type="primary" style="width: 40%;">搜索</el-button>
          <el-button style="width: 40%;">重置</el-button>
        </el-col>
      </el-row>
    </div>
    <div class="dashboard-text" style="min-height: 695px;">
      <el-row style="margin-bottom: 15px;line-height: 30px;">
        <el-col :span="12">
          <span style="font-size: 18px;font-weight: bold;">商户管理</span>
        </el-col>
        <el-col :span="12" style="text-align: right;">
          <el-button type="primary" style="width: 13%;" @click="jumpToAdd">添加</el-button>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-table
            :data="tableData"
            border
            style="width: 100%"
          >
            <el-table-column
              fixed
              prop="date"
              align="center"
              label="商户ID"
              width="150"
            />
            <el-table-column
              prop="name"
              align="center"
              label="商户名称"
              width="120"
            />
            <el-table-column
              prop="province"
              align="center"
              label="添加者"
              width="120"
            />
            <el-table-column
              prop="city"
              align="center"
              label="商户管理员"
              width="120"
            />
            <el-table-column
              prop="address"
              align="center"
              label="审核状态"
              width="300"
            />
            <el-table-column
              prop="zip"
              align="center"
              label="拒绝原因"
              width="120"
            />
            <el-table-column
              prop="city"
              align="center"
              label="可视化用户"
              width="120"
            />
            <el-table-column
              prop="address"
              align="center"
              label="店铺数量"
              width="300"
            />
            <el-table-column
              prop="zip"
              align="center"
              label="视频/教育课程"
              width="120"
            />
            <el-table-column
              prop="city"
              label="教育评论"
              align="center"
              width="120"
            />
            <el-table-column
              prop="address"
              label="店铺物料"
              align="center"
              width="300"
            />
            <el-table-column
              prop="zip"
              label="精品攻略"
              align="center"
              width="120"
            />
            <el-table-column
              prop="city"
              label="品牌介绍"
              align="center"
              width="120"
            />
            <el-table-column
              prop="address"
              label="老师介绍"
              align="center"
              width="300"
            />
            <el-table-column
              prop="address"
              align="center"
              label="seo关键词"
              width="300"
            />
            <el-table-column
              prop="zip"
              label="表单组件"
              align="center"
              width="120"
            />
            <el-table-column
              prop="city"
              label="电话组件"
              align="center"
              width="120"
            />
            <el-table-column
              prop="address"
              label="IM组件"
              align="center"
              width="300"
            />
            <el-table-column
              prop=""
              fixed="right"
              align="center"
              label="Api对接"
              width="120"
            >
              <el-switch v-model="value1" />
            </el-table-column>
            <el-table-column
              fixed="right"
              label="操作"
              align="center"
              width="100"
            >
              <template slot-scope="scope">
                <el-button type="text" size="small" style="width: 100%;" @click="handleClick(scope.row)">更新状态</el-button>
                <el-button type="text" size="small" style="width: 100%;margin-left: 0;">编辑</el-button>
                <el-button type="text" size="small" style="width: 100%;margin-left: 0;" @click="handleClick(scope.row)">商户转移</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
      <el-row style="margin: 25px 0 15px;line-height: 26px;text-align: right;">
        <el-col :span="24">
          <div class="block">
            <el-pagination
              :current-page="currentPage4"
              :page-sizes="[100, 200, 300, 400]"
              :page-size="100"
              layout="total, sizes, prev, pager, next, jumper"
              :total="400"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { getList } from '../../api/shop.js'
export default {
  name: 'Dashboard',
  data() {
    return {
      value1: true,
      currentPage4: 1,
      tableData: [],
      input: '',
      options: [{
        value: '选项1',
        label: '黄金糕'
      }, {
        value: '选项2',
        label: '双皮奶'
      }, {
        value: '选项3',
        label: '蚵仔煎'
      }, {
        value: '选项4',
        label: '龙须面'
      }, {
        value: '选项5',
        label: '北京烤鸭'
      }],
      value: ''
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    /**
     * 跳转新增页面
     */
    jumpToAdd() {
      this.$router.push({ path: '/visualization/index', query: { id: this.$route.query.id }})
    },
    handleClick(row) {
      console.log(row)
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    },
    // 获取用户列表
    getList() {
      var param = {
        pageNo: 1,
        pageSize: 10,
        status: '',
        merchantsId: '',
        createId: '',
        merchantsName: ''
      }
      getList(param).then(response => {
      }).catch(() => {
      })
    }
  },
  computed: {
    ...mapGetters([
      'name'
    ])
  }
  // methods: {
  //   // 获取用户列表
  //   getList() {
  //     getList(this.loginForm).then(response => {
  //     }).catch(() => {
  //     })
  //   }
  //   // 添加用户
  //   // addUser() {
  //   //   var data = {
  //   //     adminUsername: '',
  //   //     pid: '',
  //   //     adminFullname: ''
  //   //   }
  //   //   addUser(data).then(response => {
  //   //   }).catch(() => {
  //   //   })
  //   // }
  // }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 15px;
  }
  &-text {
    padding: 15px;
    font-size: 30px;
    line-height: 46px;
    background-color: #fff;
  }
}
</style>
